package com.whfc.ms.api.sys.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.common.util.SessionAttr;
import com.whfc.fuum.entity.SysUser;
import com.whfc.ms.api.sys.service.MsSysExternalUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: sun
 * @version: v1.0.0
 * @since 2022/6/15
 */
@RestController
@RequestMapping("/ms/api/externalUser")
public class SysExternalUserController {
    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private MsSysExternalUserService msSysExternalUserService;
    /**
     * 获取第三方平台授权信息
     * @return
     */
    @GetMapping("/selectByPlatformAndDeptId")
    public Result selectByPlatformAndDeptId(
                                            @SessionAttribute(SessionAttr.MS_USER) SysUser user,
                                            @RequestParam("deptId") Integer deptId,
                                            @RequestParam("platform") String platform) {
        logger.info("获取第三方平台授权信息：loginer:{},deptId:{},platform:{}", user.getUsername(), deptId, platform);
        return ResultUtil.success(msSysExternalUserService.selectByPlatformAndDeptId(deptId,platform));
    }
}
